﻿@model IEnumerable<SimpleTaskManager.Domain.Entities.Skill>

@{
    ViewBag.Title = "Skills";
}

<h2>Skills</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            Name
        </th>
        @if(ViewBag.CanEdit){<th></th>}
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        @if(ViewBag.CanEdit){<td>
            @Html.ActionLink("Edit", "Edit", new { id=item.SkillID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.SkillID })
        </td>}
    </tr>
}

</table>
<script>
    $(document).ready(function () {
        $("tr td a:contains('Delete')").click(function () {
            if (confirm("Are you sure you want to delete this?")) {
                return true;
            } else {
                return false;
            }
        });
    });
</script>